home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / prodpack.zip / DB4PPSRC.EXE / _DLCCENT.PRG < prev    next >
Text File  |  1993-05-06  |  4KB  |  143 lines

  1. PROCEDURE _DLCCEnt
  2. PARAMETERS pcPanel, pcCatName
  3. *----------------------------------------------------------------------------
  4. * NAME
  5. *   _DLCCEnt - Catalog Entry Program
  6. *
  7. * DESCRIPTION
  8. *
  9. * PARAMETERS
  10. *   pcPanel    = 
  11. *   pcCatName  = 
  12. *
  13. *----------------------------------------------------------------------------
  14.   SET ECHO OFF
  15.   IF SET( "TALK" ) = "ON"
  16.     SET TALK OFF
  17.     lTalk = .T.
  18.   ELSE
  19.     lTalk = .F.
  20.   ENDIF
  21.  
  22.   cDBBLib = "DBBDSGN"
  23.   lError = .F.
  24.   ON ERROR lError = .T.
  25.   SET LIBRARY TO ( cDBBLib )
  26.   IF lError
  27.     lError = .F.
  28.     SET LIBRARY TO HOME() + cDBBLib
  29.     IF lError
  30.       DO _Err_Box WITH [DBB not installed correctly]
  31.     ENDIF
  32.   ENDIF
  33.   ON ERROR
  34.  
  35.   IF TYPE( "DBW_HELP" ) <> "C"
  36.     RELEASE DBW_HELP
  37.     PUBLIC DBW_HELP
  38.     DBW_HELP = "DLGHELP"                && Name of help file for dialogs
  39.   ENDIF
  40.  
  41.   IF TYPE( "FXL_DEV" ) <> "L"
  42.     RELEASE FXL_DEV
  43.     PUBLIC FXL_DEV
  44.     FXL_DEV  = .F.                      && Developer mode on
  45.   ENDIF
  46.  
  47.   IF lTalk
  48.     SET TALK ON
  49.   ENDIF
  50.  
  51. RETURN
  52. *-- EOP: _DLCCEnt WITH pcPanel, pcCatName
  53.  
  54.  
  55. PROCEDURE _Err_Box
  56. PARAMETERS pc_msg
  57. *----------------------------------------------------------------------------
  58. * NAME
  59. *   _Err_Box - Display an error box
  60. *
  61. * SYNOPSIS
  62. *   DO _Err_Box WITH <pc_msg>
  63. *
  64. * DESCRIPTION
  65. *   _Err_Box will display the <pc_msg> string in a box and prompt the
  66. *   user to press any key to continue processing.  _Err_Box will display
  67. *   the message based on the length of <pc_msg>.
  68. *
  69. * PARAMETERS
  70. *   pc_msg - the error message to display in the box.  If the length is
  71. *            greater than 76, the trailing part is chopped off.
  72. *
  73. * EXAMPLE
  74. *   DO _Err_Box WITH "Incorrect window size"
  75. *   Displays the message in a window as follows at row 9 on the screen:
  76. *                      +------------------------------+
  77. *                      |                              |
  78. *                      |    Incorrect window size     |
  79. *                      |                              |
  80. *                      | Press any key to continue... |
  81. *                      |                              |
  82. *                      +------------------------------+
  83. *   Note that the width of the window will increase to accommodate a longer
  84. *   message string.
  85. *
  86. * LIMITATIONS
  87. *   Truncates the message after 76 characters.  Assumes an 80 character
  88. *   wide screen.  Looks best with SET CURSOR OFF.
  89. *
  90. *----------------------------------------------------------------------------
  91.  
  92.   PRIVATE lc_anykey, lc_msg, lc_msglen, lc_win, ln_press, ln_width, ll_trap,;
  93.           ll_escape
  94.  
  95.   lc_anykey = [Press any key to continue...]
  96.   ln_press  = LEN( lc_anykey )
  97.   lc_win = WINDOW()                     && Currently activated window if any
  98.   lc_msg = LTRIM( RTRIM( pc_msg ) )     && Trimmed message
  99.   ln_msglen = LEN( lc_msg )             && Trimmed length of message
  100.   ln_width = 0                          && Width of display area in window.
  101.   ll_escape = SET("ESCAPE") = "ON"
  102.  
  103.   *-- Determine the width needed for the window:
  104.   IF ln_msglen <= ln_press
  105.     ln_width = ln_press
  106.   ELSE
  107.     *-- Make sure the message fits in the window:
  108.     IF ln_msglen > 76
  109.       lc_msg = LEFT( lc_msg, 76 )
  110.       ln_msglen = 76
  111.     ENDIF
  112.     ln_width = ln_msglen
  113.   ENDIF
  114.   DEFINE WINDOW _err_box FROM 9, ((76 - ln_width) + .5) / 2 ;
  115.                 TO 15, (ln_width + 83) / 2 DOUBLE
  116.   ln_width = ( ln_width + 2 )
  117.  
  118.   *-- Display the message and prompt to the window and wait for a key press
  119.   ACTIVATE WINDOW _err_box
  120.   @ 1, ( ln_width - ln_msglen ) / 2 SAY lc_msg
  121.   @ 3, ( ln_width - ln_press ) / 2 SAY lc_anykey
  122.   SET CONSOLE OFF                       && For mouse click recognition
  123.   WAIT
  124.   SET CONSOLE ON
  125.  
  126.   *-- Clean up the window display and reactivate the previous window
  127.   RELEASE WINDOW _err_box
  128.   IF ISBLANK( lc_win )
  129.     ACTIVATE SCREEN
  130.   ENDIF
  131.  
  132.   IF ll_escape
  133.     SET ESCAPE ON
  134.   ELSE
  135.     SET ESCAPE OFF
  136.   ENDIF
  137.  
  138. RETURN
  139. *-- EOP: _Err_Box WITH pc_msg
  140.  
  141.  
  142.  
  143.